package android.medicalcloud.com.yiapp.yilian.ui.fragment;

import android.medicalcloud.com.yiapp.R;
import android.medicalcloud.com.yiapp.base.fragment.BaseFragment;
import android.medicalcloud.com.yiapp.yilian.model.OrderModel;
import android.medicalcloud.com.yiapp.yilian.ui.view.adapter.OderItemAdapter;
import android.medicalcloud.com.yiapp.yilian.utils.android.IntentTool;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wanggenlin on 17-5-18.
 */
public class OrderItemFragment extends BaseFragment {

   ListView listView;
    @Override
    protected void initView(View view) {
        listView =(ListView) view.findViewById(R.id.lv);
        List<OrderModel> list = new ArrayList<>();
        OrderModel model= new OrderModel();
        list.add(model);
        list.add(model);
        list.add(model);
        list.add(model);
        final OderItemAdapter adapter = new OderItemAdapter(getContext());
        listView.setAdapter(adapter);
        adapter.setRes(list);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                IntentTool.orderDetail(getContext(),adapter.getItem(position));
            }
        });

    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fra_order_type;
    }


    public static final String ARG_PAGE = "ARG_PAGE";
    private int mPage;

    public static OrderItemFragment newInstance(int page) {
        Bundle args = new Bundle();
        args.putInt(ARG_PAGE, page);
        OrderItemFragment pageFragment = new OrderItemFragment();
        pageFragment.setArguments(args);
        return pageFragment;
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPage = getArguments().getInt(ARG_PAGE);
    }

}
